namespace Guia.Elements
{
    using System.Windows.Automation;
    using Guia.Core;
    using Guia.Locator;

    /// <summary>
    /// This class represents a PasswordBox.
    /// </summary>
    public class PasswordBox : TextBox
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PasswordBox"/> class.
        /// </summary>
        /// <param name="automationElement">
        /// The automation element.
        /// </param>
        public PasswordBox(AutomationElement automationElement)
            : base(automationElement)
        {
        }

        /// <summary>
        /// Gets the default-condition to find a control by its type.
        /// </summary>
        public static new SearchCondition ControlTypeCondition
        {
            get { return SearchCondition.ByControlType(ControlType.Edit).And(SearchCondition.ByClassName("PasswordBox")); }
        }

        /// <summary>
        /// Sets the Value.
        /// </summary>
        /// <exception cref="OperationNotSupportedException">
        /// The OperationNotSupportedException is thrown when the PasswordBox is not writable (enabled).
        /// </exception>
        public new string Value
        {
            set
            {
                base.Value = value;
            }
        }
    }
}